SlideShare a Scribd company logo
1 of 42
Graph API
Facebook Developer Garage Taipei


          CardinalBlue


 john, godfat @
Graph API

•What is it?
• What to do?
• What’s new?
Graph API: What is it?


• Launched at F8 (April 2010)
• Simple REST API
• Completely new!
Your apps
will fail...
soon.


    APP
http://graph.facebook.com
http://graph.facebook.com/cocacola/picture
http://graph.facebook.com/hellokitty/picture
http://graph.facebook.com/4/picture
http://graph.facebook.com/search?q=taiwan
http://graph.facebook.com/hellokitty
{
   "id": "40444963499",
   "name": "Hello Kitty",
   "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/
hs625.ash1/27537_40444963499_5441_s.jpg",
   "link": "http://www.facebook.com/hellokitty",
   "category": "Public_figures_other",
   "username": "hellokitty",
   "affiliation": "Sanrio Inc. USA",
   "birthday": "11/01/-001",
   "personal_info": "Hello Kitty's Official Fan Page!nHello Kitty lives in the
suburbs of London with her parents and her twin sister Mimmy. She has lots of
friends at school with whom she shares many adventures.nHer trademark is
her red bow that she always wears over her left ear.nHello Kitty is as heavy as
three apples and as tall as five apples.",
   "personal_interests": "Traveling, listening to music, reading, eating yummy
cookies, and making new friends. As Hello Kitty always says, u201cYou can
never have too many friends!"nShe collects small, cute objects like ribbons,
hair accessories, candy, stars, and goldfish.",
   "fan_count": 267913,
   "type": "page"
}
Connections
http://graph.facebook.com/hellokitty?metadata=1

   "metadata": {
     "connections": {
       "feed": "http://graph.facebook.com/hellokitty/feed",
       "posts": "http://graph.facebook.com/hellokitty/posts",
       "tagged": "http://graph.facebook.com/hellokitty/tagged",
       "statuses": "http://graph.facebook.com/hellokitty/statuses",
       "links": "http://graph.facebook.com/hellokitty/links",
       "notes": "http://graph.facebook.com/hellokitty/notes",
       "photos": "http://graph.facebook.com/hellokitty/photos",
       "albums": "http://graph.facebook.com/hellokitty/albums",
       "events": "http://graph.facebook.com/hellokitty/events",
       "videos": "http://graph.facebook.com/hellokitty/videos"
     }
   }
object

         connection
                      objects
http://graph.facebook.com/hellokitty/posts
{
   "data": [
      {
         "id": "40444963499_420034668499",
         "from": {
             "name": "Hello Kitty",
             "category": "Public_figures_other",
             "id": "40444963499"
         },
         "message": "Check out the cute Hello Kitty Nerds tote featured in Us Weekly! Find this and more Hello Kitty
u201cNerdsu201d stuff at Sanrio.com and select Sanrio Boutiques.nnhttp://bit.ly/brVYHTn",
         "picture": "http://photos-h.ak.fbcdn.net/hphotos-ak-ash2/
hs003.ash2/33501_420032663499_40444963499_4947695_6515646_s.jpg",
         "link": "http://www.facebook.com/photo.php?pid=4947695&fbid=420032663499&id=40444963499",
         "name": "Nerd Alert!",
         "caption": "5 new photos",
         "icon": "http://static.ak.fbcdn.net/rsrc.php/z2E5Y/hash/8as8iqdm.gif",
         "type": "photo",
         "created_time": "2010-08-20T01:04:30+0000",
         "updated_time": "2010-08-20T01:04:30+0000",
         "likes": 892,
         "comments": {
             "count": 76
         }
      },
      {
         "id": "40444963499_419689583499",
         "from": {
             "name": "Hello Kitty",
             "category": "Public_figures_other",
             "id": "40444963499"
         },
         "message": "Weu2019ve been playing with the Hello Kitty 35 mm Fisheye camera by Lomography and wanted to share
some of the fun pictures weu2019ve taken! Has anyone else taken any awesome pictures with their Hello Kitty Fisheye
cameras? Post them to our wall, we wanna see them! nnThe Hello Kitty Fisheye Camera is now available at Sanrio.com, select
Sanrio Boutiques, Urban Outfitters, Lomography.com and Lomography gallery stores. nnhttp://bit.ly/91unb4n",
         "picture": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc4/
hs389.snc4/45262_419686073499_40444963499_4941020_5615227_s.jpg",
         "link": "http://www.facebook.com/photo.php?pid=4941020&fbid=419686073499&id=40444963499",
         "name": "Fisheye Camera Photos",
         "icon": "http://static.ak.fbcdn.net/rsrc.php/z2E5Y/hash/8as8iqdm.gif",
         "type": "photo",
Most data
  requires
explicit user
 permission
Access Token

•Obtained when a user gives
 permissions to a Facebook
 application
•Used for making Graph API calls
 For testing, try: http://oauth.twoalex.com
Access Token Usage
https://graph.facebook.com/me?access_token=...
https://graph.facebook.com/me/feed?access_token=...
https://graph.facebook.com/me/likes?access_token=...
https://graph.facebook.com/me/friends?access_token=
https://graph.facebook.com/4/feed?access_token=...


              Explore Graph API:
       http://aiphone1.heroku.com
How to get an access token

• Redirect to OAuth
 • https://graph.facebook.com/oauth/authorize ...
 • https://graph.facebook.com/oauth/access_token ...
• Javascript SDK
 • User clicks on login button
 • SDK stores the access token into a cookie
Extended Permissions
When authenticating, can ask the user for
extended permissions:

• user_photos, friend_photos
• user_likes, friend_likes
• read_stream, publish_stream
• email
• offline_access
• and many more....
Graph API

•What is it?
• What to do?
• What’s new?
Types of Facebook Apps

• Canvas FBML
• Canvas iframe
• Website
• Mobile website
• Mobile (native)
• Desktop
Canvas apps


•   Canvas FBML
•   Canvas iframe
Canvas apps


•   Canvas FBML
•   Canvas iframe
Major Changes for Canvas Apps
By end of this year (2010):
1. Canvas FBML will be deprecated...
  you must use Canvas iframe!
2. The Facebook “session_key” will disappear...
  you must use access_token for API calls!
3. The “fb_sig” parameters will disappear...
  you must query and cache user data!
1. Must use canvas iframe

• Many FBML tags not supported in iframe
• Use Javascript SDK to get XFBML (which is a
  subset of FBML tags for iframe apps)
  <fb:name uid=’4’></fb:name>


• After end of 2010, FBML apps cannot be created.
2. Must use access token
  • You need to upgrade your SDK library
  • All calls to Facebook must be made with an
     access token:

      ‣ FQL Query
https://api.facebook.com/method/fql.query?query=...&access_token=...


      ‣ Old REST API calls
https://api.facebook.com/method/stream.publish?access_token=...

https://api.facebook.com/method/pages.isFan?page_id=...&access_token=...
Facebook’s PHP SDK
  http://github.com/facebook/php-sdk/

 $me = $facebook->api('/me');
 $mark = $facebook->api('/4');

 $loginUrl = $facebook->getLoginUrl();

 <a href="<?php echo $loginUrl; ?>">
   Click to Login
 </a>
Our Ruby SDK
http://github.com/cardinalblue/rest-graph
3. Must query and cache user data
• Instead of many “fb_sig” parameters, Facebook will
  only pass a signed_request (containing access
  token and user id)
• Many parameters will disappear, so you will need
  to query and cache them yourself...
• fb_sig_friends =>
  https://graph.facebook.com/me/friends?...
• fb_sig_locale =>
  https://api.facebook.com/methods/users.getInfo?...
Types of Facebook Apps
              Authentication         Markup        Access Token


Canvas
                                     FBML
 FBML                                                        signed
                                                            request
Canvas
iframe    Redirect to
            OAuth
                                              from cookie
                        Javascript
                                               (placed by
Website                    SDK       XFBML     Javascript
                                                  SDK)

Mobile
website
Summary: What to do?

• Switch to new SDK
• Use new login and get permissions
• Convert all FQL queries and Old REST
  API calls into Graph API calls

• Remove any references to fb_sig
• For performance, set up caching
Graph API

•What is it?
• What to do?
• What’s new?
What’s new?


• Open Graph Protocol
• Facebook Places API
anything can be an
               object
http://graph.facebook.com/http://www.facebook.com




           even an URL!
not much
information though
{
    "id": "http://www.facebook.com",
    "shares": 666837
}
but this one...
http://graph.facebook.com/http://www.imdb.com/title/tt0117500/


     {
       "id": "114324145263104",
       "name": "The Rock (1996)",
       "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/
     hs344.snc4/41581_114324145263104_7037_s.jpg",
       "link": "http://www.imdb.com/title/tt0117500/",
       "category": "Movie",
       "description": "Directed by Michael Bay. With Sean Connery, Nicolas Cage, Ed
     Harris. A group of U.S. marines, under command of a renegade general, take over
     Alcatraz and threat San Francisco Bay with biological weapons. A chemical weapons
     specialist and the only man to have ever escaped from the Rock are the only ones
     who can prevent chaos. Visit IMDb for Photos, Showtimes, Cast, Crew, Reviews, Plot
     Summary, Comments, Discussions, Taglines, Trailers, Posters, Fan Sites",
       "fan_count": 931
     }
...has connections
http://graph.facebook.com/http://www.imdb.com/title/tt0117500?metadata=1


   {
       "id": "118133258218514",
       [...],
       "metadata": {
          "connections": {
             "feed": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/feed",
             "posts": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/posts",
             "tagged": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/tagged",
             "statuses": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/statuses",
             "links": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/links",
             "notes": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/notes",
             "photos": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/photos",
             "albums": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/albums",
             "events": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/events",
             "videos": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/videos"
          }
       },
       "type": "page"
   }
adding <meta> tag
 to any web page
   turns it into a
  facebook object
Open Graph Protocol
Facebook Places
Graph API for checkins
Extended permissions:
 user_checkins, friend_checkins


https://graph.facebook.com/[user id]/checkins
https://graph.facebook.com/[place page id]/checkins
https://graph.facebook.com/search?type=checkins
See where your friends have checked in:
http://fbfetcher.heroku.com/
        welcome/places
Graph API
• What is it?
  Simple new REST API with OAuth2.0
• What to do?
  Rewrite your apps using new SDKs
• What’s new?
  Open Graph, Facebook Places.
Graph API - Facebook Developer Garage Taipei

More Related Content

Similar to Graph API - Facebook Developer Garage Taipei

Facebook Platform for Developers
Facebook Platform for DevelopersFacebook Platform for Developers
Facebook Platform for DevelopersLidan Hifi
 
Developing for Mobile
Developing for MobileDeveloping for Mobile
Developing for MobileRemy Sharp
 
Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Nicholas Zakas
 
Real-time Semantic Web with Twitter Annotations
Real-time Semantic Web with Twitter AnnotationsReal-time Semantic Web with Twitter Annotations
Real-time Semantic Web with Twitter AnnotationsJoshua Shinavier
 
Facebook open graph Presentation
Facebook open graph PresentationFacebook open graph Presentation
Facebook open graph PresentationIncheol Baek
 
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Nicholas Zakas
 
Using HTML5 for a great Open Web
Using HTML5 for a great Open WebUsing HTML5 for a great Open Web
Using HTML5 for a great Open WebRobert Nyman
 
HTML5 Conference [LT] Blue Light Filter 50% Off
HTML5 Conference [LT] Blue Light Filter 50% OffHTML5 Conference [LT] Blue Light Filter 50% Off
HTML5 Conference [LT] Blue Light Filter 50% OffYusuke Kawasaki
 
Facebook and its development
Facebook and its developmentFacebook and its development
Facebook and its developmentTao Wang
 
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQLOpen Hack London - Introduction to YQL
Open Hack London - Introduction to YQLChristian Heilmann
 
HackMIT Presentation
HackMIT PresentationHackMIT Presentation
HackMIT PresentationMatt Harris
 
HTML5 for Web Designers
HTML5 for Web DesignersHTML5 for Web Designers
HTML5 for Web DesignersGoodbytes
 
WEB SOCKET 應用
WEB SOCKET 應用WEB SOCKET 應用
WEB SOCKET 應用Jerromy Lee
 
Papaya webinar: leveraging lifecycle
Papaya webinar: leveraging lifecyclePapaya webinar: leveraging lifecycle
Papaya webinar: leveraging lifecyclePapayaMobile
 
Take a Picture, It'll Last Longer
Take a Picture, It'll Last LongerTake a Picture, It'll Last Longer
Take a Picture, It'll Last LongerDean Shareski
 
Build Your First Mobile App in 1 hour with Windows App Studio
Build Your First Mobile App in 1 hour with Windows App StudioBuild Your First Mobile App in 1 hour with Windows App Studio
Build Your First Mobile App in 1 hour with Windows App StudioNick Landry
 

Similar to Graph API - Facebook Developer Garage Taipei (20)

Facebook Platform for Developers
Facebook Platform for DevelopersFacebook Platform for Developers
Facebook Platform for Developers
 
Making sense out of things on the web
Making sense out of things on the webMaking sense out of things on the web
Making sense out of things on the web
 
Developing for Mobile
Developing for MobileDeveloping for Mobile
Developing for Mobile
 
Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)
 
Real-time Semantic Web with Twitter Annotations
Real-time Semantic Web with Twitter AnnotationsReal-time Semantic Web with Twitter Annotations
Real-time Semantic Web with Twitter Annotations
 
Facebook open graph Presentation
Facebook open graph PresentationFacebook open graph Presentation
Facebook open graph Presentation
 
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
 
Using HTML5 for a great Open Web
Using HTML5 for a great Open WebUsing HTML5 for a great Open Web
Using HTML5 for a great Open Web
 
HTML5 Conference [LT] Blue Light Filter 50% Off
HTML5 Conference [LT] Blue Light Filter 50% OffHTML5 Conference [LT] Blue Light Filter 50% Off
HTML5 Conference [LT] Blue Light Filter 50% Off
 
Technical Introduction to YDN
Technical Introduction to YDNTechnical Introduction to YDN
Technical Introduction to YDN
 
YQL - HackU IIT Madras 2012
YQL - HackU IIT Madras 2012YQL - HackU IIT Madras 2012
YQL - HackU IIT Madras 2012
 
Facebook and its development
Facebook and its developmentFacebook and its development
Facebook and its development
 
Open Hack London - Introduction to YQL
Open Hack London - Introduction to YQLOpen Hack London - Introduction to YQL
Open Hack London - Introduction to YQL
 
HackMIT Presentation
HackMIT PresentationHackMIT Presentation
HackMIT Presentation
 
HTML5 for Web Designers
HTML5 for Web DesignersHTML5 for Web Designers
HTML5 for Web Designers
 
Web services and JavaScript
Web services and JavaScriptWeb services and JavaScript
Web services and JavaScript
 
WEB SOCKET 應用
WEB SOCKET 應用WEB SOCKET 應用
WEB SOCKET 應用
 
Papaya webinar: leveraging lifecycle
Papaya webinar: leveraging lifecyclePapaya webinar: leveraging lifecycle
Papaya webinar: leveraging lifecycle
 
Take a Picture, It'll Last Longer
Take a Picture, It'll Last LongerTake a Picture, It'll Last Longer
Take a Picture, It'll Last Longer
 
Build Your First Mobile App in 1 hour with Windows App Studio
Build Your First Mobile App in 1 hour with Windows App StudioBuild Your First Mobile App in 1 hour with Windows App Studio
Build Your First Mobile App in 1 hour with Windows App Studio
 

Recently uploaded

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 

Recently uploaded (20)

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

Graph API - Facebook Developer Garage Taipei

  • 1. Graph API Facebook Developer Garage Taipei CardinalBlue john, godfat @
  • 2. Graph API •What is it? • What to do? • What’s new?
  • 3. Graph API: What is it? • Launched at F8 (April 2010) • Simple REST API • Completely new!
  • 6. http://graph.facebook.com/hellokitty { "id": "40444963499", "name": "Hello Kitty", "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/ hs625.ash1/27537_40444963499_5441_s.jpg", "link": "http://www.facebook.com/hellokitty", "category": "Public_figures_other", "username": "hellokitty", "affiliation": "Sanrio Inc. USA", "birthday": "11/01/-001", "personal_info": "Hello Kitty's Official Fan Page!nHello Kitty lives in the suburbs of London with her parents and her twin sister Mimmy. She has lots of friends at school with whom she shares many adventures.nHer trademark is her red bow that she always wears over her left ear.nHello Kitty is as heavy as three apples and as tall as five apples.", "personal_interests": "Traveling, listening to music, reading, eating yummy cookies, and making new friends. As Hello Kitty always says, u201cYou can never have too many friends!"nShe collects small, cute objects like ribbons, hair accessories, candy, stars, and goldfish.", "fan_count": 267913, "type": "page" }
  • 7. Connections http://graph.facebook.com/hellokitty?metadata=1 "metadata": { "connections": { "feed": "http://graph.facebook.com/hellokitty/feed", "posts": "http://graph.facebook.com/hellokitty/posts", "tagged": "http://graph.facebook.com/hellokitty/tagged", "statuses": "http://graph.facebook.com/hellokitty/statuses", "links": "http://graph.facebook.com/hellokitty/links", "notes": "http://graph.facebook.com/hellokitty/notes", "photos": "http://graph.facebook.com/hellokitty/photos", "albums": "http://graph.facebook.com/hellokitty/albums", "events": "http://graph.facebook.com/hellokitty/events", "videos": "http://graph.facebook.com/hellokitty/videos" } }
  • 8. object connection objects
  • 9. http://graph.facebook.com/hellokitty/posts { "data": [ { "id": "40444963499_420034668499", "from": { "name": "Hello Kitty", "category": "Public_figures_other", "id": "40444963499" }, "message": "Check out the cute Hello Kitty Nerds tote featured in Us Weekly! Find this and more Hello Kitty u201cNerdsu201d stuff at Sanrio.com and select Sanrio Boutiques.nnhttp://bit.ly/brVYHTn", "picture": "http://photos-h.ak.fbcdn.net/hphotos-ak-ash2/ hs003.ash2/33501_420032663499_40444963499_4947695_6515646_s.jpg", "link": "http://www.facebook.com/photo.php?pid=4947695&fbid=420032663499&id=40444963499", "name": "Nerd Alert!", "caption": "5 new photos", "icon": "http://static.ak.fbcdn.net/rsrc.php/z2E5Y/hash/8as8iqdm.gif", "type": "photo", "created_time": "2010-08-20T01:04:30+0000", "updated_time": "2010-08-20T01:04:30+0000", "likes": 892, "comments": { "count": 76 } }, { "id": "40444963499_419689583499", "from": { "name": "Hello Kitty", "category": "Public_figures_other", "id": "40444963499" }, "message": "Weu2019ve been playing with the Hello Kitty 35 mm Fisheye camera by Lomography and wanted to share some of the fun pictures weu2019ve taken! Has anyone else taken any awesome pictures with their Hello Kitty Fisheye cameras? Post them to our wall, we wanna see them! nnThe Hello Kitty Fisheye Camera is now available at Sanrio.com, select Sanrio Boutiques, Urban Outfitters, Lomography.com and Lomography gallery stores. nnhttp://bit.ly/91unb4n", "picture": "http://photos-f.ak.fbcdn.net/hphotos-ak-snc4/ hs389.snc4/45262_419686073499_40444963499_4941020_5615227_s.jpg", "link": "http://www.facebook.com/photo.php?pid=4941020&fbid=419686073499&id=40444963499", "name": "Fisheye Camera Photos", "icon": "http://static.ak.fbcdn.net/rsrc.php/z2E5Y/hash/8as8iqdm.gif", "type": "photo",
  • 10. Most data requires explicit user permission
  • 11. Access Token •Obtained when a user gives permissions to a Facebook application •Used for making Graph API calls For testing, try: http://oauth.twoalex.com
  • 13. How to get an access token • Redirect to OAuth • https://graph.facebook.com/oauth/authorize ... • https://graph.facebook.com/oauth/access_token ... • Javascript SDK • User clicks on login button • SDK stores the access token into a cookie
  • 14. Extended Permissions When authenticating, can ask the user for extended permissions: • user_photos, friend_photos • user_likes, friend_likes • read_stream, publish_stream • email • offline_access • and many more....
  • 15.
  • 16.
  • 17. Graph API •What is it? • What to do? • What’s new?
  • 18. Types of Facebook Apps • Canvas FBML • Canvas iframe • Website • Mobile website • Mobile (native) • Desktop
  • 19. Canvas apps • Canvas FBML • Canvas iframe
  • 20. Canvas apps • Canvas FBML • Canvas iframe
  • 21. Major Changes for Canvas Apps By end of this year (2010): 1. Canvas FBML will be deprecated... you must use Canvas iframe! 2. The Facebook “session_key” will disappear... you must use access_token for API calls! 3. The “fb_sig” parameters will disappear... you must query and cache user data!
  • 22. 1. Must use canvas iframe • Many FBML tags not supported in iframe • Use Javascript SDK to get XFBML (which is a subset of FBML tags for iframe apps) <fb:name uid=’4’></fb:name> • After end of 2010, FBML apps cannot be created.
  • 23. 2. Must use access token • You need to upgrade your SDK library • All calls to Facebook must be made with an access token: ‣ FQL Query https://api.facebook.com/method/fql.query?query=...&access_token=... ‣ Old REST API calls https://api.facebook.com/method/stream.publish?access_token=... https://api.facebook.com/method/pages.isFan?page_id=...&access_token=...
  • 24. Facebook’s PHP SDK http://github.com/facebook/php-sdk/  $me = $facebook->api('/me'); $mark = $facebook->api('/4'); $loginUrl = $facebook->getLoginUrl(); <a href="<?php echo $loginUrl; ?>"> Click to Login </a>
  • 26. 3. Must query and cache user data • Instead of many “fb_sig” parameters, Facebook will only pass a signed_request (containing access token and user id) • Many parameters will disappear, so you will need to query and cache them yourself... • fb_sig_friends => https://graph.facebook.com/me/friends?... • fb_sig_locale => https://api.facebook.com/methods/users.getInfo?...
  • 27.
  • 28. Types of Facebook Apps Authentication Markup Access Token Canvas FBML FBML signed request Canvas iframe Redirect to OAuth from cookie Javascript (placed by Website SDK XFBML Javascript SDK) Mobile website
  • 29. Summary: What to do? • Switch to new SDK • Use new login and get permissions • Convert all FQL queries and Old REST API calls into Graph API calls • Remove any references to fb_sig • For performance, set up caching
  • 30. Graph API •What is it? • What to do? • What’s new?
  • 31. What’s new? • Open Graph Protocol • Facebook Places API
  • 32. anything can be an object http://graph.facebook.com/http://www.facebook.com even an URL!
  • 33. not much information though { "id": "http://www.facebook.com", "shares": 666837 }
  • 34. but this one... http://graph.facebook.com/http://www.imdb.com/title/tt0117500/ { "id": "114324145263104", "name": "The Rock (1996)", "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/ hs344.snc4/41581_114324145263104_7037_s.jpg", "link": "http://www.imdb.com/title/tt0117500/", "category": "Movie", "description": "Directed by Michael Bay. With Sean Connery, Nicolas Cage, Ed Harris. A group of U.S. marines, under command of a renegade general, take over Alcatraz and threat San Francisco Bay with biological weapons. A chemical weapons specialist and the only man to have ever escaped from the Rock are the only ones who can prevent chaos. Visit IMDb for Photos, Showtimes, Cast, Crew, Reviews, Plot Summary, Comments, Discussions, Taglines, Trailers, Posters, Fan Sites", "fan_count": 931 }
  • 35. ...has connections http://graph.facebook.com/http://www.imdb.com/title/tt0117500?metadata=1 { "id": "118133258218514", [...], "metadata": { "connections": { "feed": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/feed", "posts": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/posts", "tagged": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/tagged", "statuses": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/statuses", "links": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/links", "notes": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/notes", "photos": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/photos", "albums": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/albums", "events": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/events", "videos": "http://graph.facebook.com/http://www.imdb.com/title/tt0117500/videos" } }, "type": "page" }
  • 36. adding <meta> tag to any web page turns it into a facebook object
  • 39. Graph API for checkins Extended permissions: user_checkins, friend_checkins https://graph.facebook.com/[user id]/checkins https://graph.facebook.com/[place page id]/checkins https://graph.facebook.com/search?type=checkins
  • 40. See where your friends have checked in: http://fbfetcher.heroku.com/ welcome/places
  • 41. Graph API • What is it? Simple new REST API with OAuth2.0 • What to do? Rewrite your apps using new SDKs • What’s new? Open Graph, Facebook Places.

Editor's Notes